<template>
  <Viewer :value="value" :plugins="plugins" />
</template>

<script lang="ts" setup>
import gfm from "@bytemd/plugin-gfm";
import highlight from "@bytemd/plugin-highlight";
import mermaid from "@bytemd/plugin-mermaid";
import { Viewer } from "@bytemd/vue-next";
import "bytemd/dist/index.css";
import "juejin-markdown-themes/dist/juejin.css";
import "highlight.js/styles/vs.css";
import zh_Hans from "bytemd/locales/zh_Hans.json";
import { defineProps, withDefaults } from "vue";

// 定义组件类型
interface Props {
  value: string;
}

// 使用defineProps接收传递参数
const props = withDefaults(defineProps<Props>(), {
  value: () => "",
});

const plugins = [
  gfm(),
  // Add more plugins here
  highlight(),
  mermaid(),
];
</script>

<style>
// 将scoped去掉即可
.bytemd-toolbar-icon.bytemd-tippy.bytemd-tippy-right:last-child {
  display: none;
}
</style>
